package com.atguigu.gulimall.product.entity;

import com.atguigu.common.group.AddGroup;
import com.atguigu.common.group.ListValue;
import com.atguigu.common.group.UpdateGroup;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.util.Date;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.*;

/**
 * 品牌
 * 
 * @author lxx
 * @email 1914264274@qq.com
 * @date 2022-03-08 11:28:16
 */
@Data
@TableName("pms_brand")
public class BrandEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 品牌id
	 */
	@TableId
	@NotNull(message = "修改时品牌编号不能为空",groups = {UpdateGroup.class})
	@Null(message = "新增不能指定品牌编号",groups = {AddGroup.class})
	private Long brandId;
	/**
	 * 品牌名
	 */
	@NotBlank(message = "品牌名不能为空",groups = {AddGroup.class, UpdateGroup.class})
	private String name;
	/**
	 * 品牌logo地址
	 */
	@NotBlank(groups = AddGroup.class)
	@URL(message = "logo地址必须为一个合法的url地址",groups = {AddGroup.class,UpdateGroup.class})
	private String logo;
	/**
	 * 介绍
	 */
	private String descript;
	/**
	 * 显示状态[0-不显示；1-显示]
	 */
	@NotNull(message = "显示状态不能为空",groups = {AddGroup.class})
	@Min(value = 0,groups = {AddGroup.class,UpdateGroup.class})
	@Max(value = 1,groups = {AddGroup.class,UpdateGroup.class})
	@ListValue(value = {0,1})
	private Integer showStatus;
	/**
	 * 检索首字母
	 */
	@NotNull(message = "检索首字母不能为null",groups = {AddGroup.class})
	@Pattern(regexp="^[a-zA-Z]$",groups = {AddGroup.class,UpdateGroup.class})
	private String firstLetter;
	/**
	 * 排序
	 */
	@NotNull(message = "排序字段不能为空且不能小于0",groups = {AddGroup.class})
	@Min(value = 0,groups = {AddGroup.class,UpdateGroup.class})
	private Integer sort;

}
